let data = {
  a: {
    b: {
      c: {
        d: {
          name: 'hello'
        }
      }
    }
  }
}

let str = 'a.b.c.d.name'

let list = str.split('.')

function getValueByPath(data, path){
  let paths = path.split(".")
  let value = null
  let res = data
  while(value = paths.shift()){
    res = res[value]
  }
  return res
}

console.log("------------- ", getValueByPath(data, str))
